﻿
@{
    ViewBag.Title = ViewBag.CurrentMenuName;
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<div class="content">
    <div class="clear"></div>
    <table style="width: 100%">
        <tr>
            <td style="height: 40px;">
                <div id="nav"><a href="/Log/Index" title="">@ViewBag.Title.ToUpper()</a></div>
            </td>
        </tr>
        <tr>
            <td style="">
                <div style="width: 90%;">
                    <div>
                        <div class="col-md-2" style="text-align: right; padding: 4px; ">
                            Tài khoản
                        </div>
                        <div class="col-md-4">
                            <input type="text" class="txtsearch TextBoxContent" style="width: 100% !important" id="input-account" name="Account">
                        </div>
                        <div class="col-md-2" style="text-align: right; padding: 4px">
                            Phần mềm
                        </div>
                        <div class="col-md-4">                            
                            @Html.DropDownList("appid", new SelectList(ViewBag.AppList, "value", "text", 0), new {@style = "width: 100% !important", @id = "app-id", @name = "appid", @class = "TextBoxContent", @placeholder = "" })
                        </div>
                        <div class="col-md-2" style="text-align: right; padding: 4px">
                            Chức năng
                        </div>
                        <div class="col-md-4">
                            <input type="text" class="txtsearch TextBoxContent" style="width: 100% !important" id="input-function" name="Function">
                        </div>                   
                        <div class="col-md-2" style="text-align: right; padding: 4px">
                            Action
                        </div>
                        <div class="col-md-4">
                            <input type="text" class="txtsearch TextBoxContent" style="width: 100% !important" id="input-action" name="Action">
                        </div>          
                        <div class="col-md-2" style="text-align: right; padding: 4px">
                            Từ ngày
                        </div>
                        <div class="col-md-4">
                            <input type="text" class="txtsearch TextBoxContent" style="width: 100% !important" id="start-date-search" name="StartDate">
                        </div>
                        <div class="col-md-2" style="text-align: right; padding: 4px">
                            Đến ngày
                        </div>
                        <div class="col-md-4">
                            <input type="text" class="txtsearch TextBoxContent" style="width: 100% !important" id="end-date-search" name="EndDate">
                        </div>
                    </div>

                    <div>
                        <div style="height: 10px;"></div>
                        <div class="col-md-12">
                            <div style="padding-top: 10px; text-align: center">
                                <div class="col-md-12">
                                    <span class="input-group-btn">
                                        <button class="btn btn-primary" type="button" onclick="return btnSearchClick();">
                                            <span class="glyphicon glyphicon-search"></span>Tìm kiếm
                                        </button>
                                    </span>
                                    <br />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div id="container-list">
                    @{
                        Html.RenderPartial("_LogList");
                    }
                </div>
            </td>
        </tr>
    </table>
</div>

<script type="text/javascript">
    $(document).ready(function () {
        datepicker.register('start-date-search');
        datepicker.register('end-date-search');
        CheckDateTime("start-date-search", "end-date-search");
        keypress.register("start-date-search");
        keypress.register("end-date-search");

        $("#input-account").on("keypress", function (event) {
            if (event.which == 13) {
                OnCriteria(0);
            }
        });

        $("#input-software").on("keypress", function (event) {
            if (event.which == 13) {
                OnCriteria(0);
            }
        });

        $("#input-function").on("keypress", function (event) {
            if (event.which == 13) {
                OnCriteria(0);
            }
        });

        $("#input-action").on("keypress", function (event) {
            if (event.which == 13) {
                OnCriteria(0);
            }
        });
        $("#app-id").change(function () {
            OnCriteria(0);
        });
    });

    function btnSearchClick() {
        OnCriteria(0);
    }

    function dateToSearchValid() {
        if (!datepicker.isEndDateEmpty('end-date-search')) {
            if (datepicker.isStartDateEmpty('start-date-search')) {
                return false;
            }
        }

        return true;
    }

    @functions{
        public string GetAntiForgeryToken()
        {
            string cookieToken, formToken;
            AntiForgery.GetTokens(null, out cookieToken, out formToken);
            return cookieToken + "," + formToken;
        }
    }
</script>
